Start a DXL script from Excel?

Hi,

 

is there any way to start a DXL-script from excel? I assume, that I have a button in Excel like "Start DXL Export". If you click on this button, excel starts not visible the DXL-Client and the script.

But: I don't understand, how to say doors where's the DXL-Code located or the other way to deliver DXL-Code from Excel to Doors? Is there anybody who have an idea which solves my problem?

Thx!


tobi_mehrl - Mon Apr 11 02:23:25 EDT 2016

Re: Start a DXL script from Excel?
tobi_mehrl - Mon Apr 11 04:32:41 EDT 2016

I have read, that you can start a dxl script with Windows Command.

 

'The invisible command console
    waitOnReturn = True
    windowStyle = 1
    wsh.Run "cmd /c ""C:\Program Files (x86)\IBM\Rational\Doors\9.5\bin""", windowStyle, waitOnReturn
    
    'Command string with user specified account-information will be assembled with the next lines of code
    myCommandString = myCommandString & "doors.exe "
    myCommandString = myCommandString & " -user "
    myCommandString = myCommandString & myUsername
    myCommandString = myCommandString & " -password "
    myCommandString = myCommandString & myPassword
    
    extractedDoorsPathFromConfigSheet = wsConfig.Cells(1, 2)
    myCommandString = myCommandString & " -D ""string myModuleName=\""" & extractedDoorsPathFromConfigSheet & "\"""""
    myCommandString = myCommandString & "-b D:\ExportModulesToExcel.dxl"
    
    'The command string which is stored in "myCommandString" which will be exectued in the invisible command console
    wsh.Run myCommandString, windowStyle, waitOnReturn

 

 

This script now gets the accountdata over a Excel-GUI-Box. In myCommandString is the Batchstring. In the file ExportModulesToExcel.dxl is the script, which runs without failures if you start the script manually in the Interaction-Window, but in case of starting over this command-console, i'm getting a three failures:

-E- DXL: <Line:1> Falsche Argumente für -)
-E- DXL: <Line:1> Nicht deklarierte Variable (b)
-E- DXL: <Line:1> Falsche Argumente für =)

 

I'm weird because the fact, that the script is runnin manually I'm getting no failures but if I start the script automized wih the console, I'm getting failures. Also the Client starts invisible!

If I write the "myCommandString = myCommandString & "-b D:\ExportModulesToExcel.dxl"" line between "myCommandString = myCommandString & "doors.exe "" and "myCommandString = myCommandString & " -user "", the Client starts invisible!

Re: Start a DXL script from Excel?
DOORSHAM - Mon Apr 11 07:50:50 EDT 2016

tobi_mehrl - Mon Apr 11 04:32:41 EDT 2016

I have read, that you can start a dxl script with Windows Command.

 

'The invisible command console
    waitOnReturn = True
    windowStyle = 1
    wsh.Run "cmd /c ""C:\Program Files (x86)\IBM\Rational\Doors\9.5\bin""", windowStyle, waitOnReturn
    
    'Command string with user specified account-information will be assembled with the next lines of code
    myCommandString = myCommandString & "doors.exe "
    myCommandString = myCommandString & " -user "
    myCommandString = myCommandString & myUsername
    myCommandString = myCommandString & " -password "
    myCommandString = myCommandString & myPassword
    
    extractedDoorsPathFromConfigSheet = wsConfig.Cells(1, 2)
    myCommandString = myCommandString & " -D ""string myModuleName=\""" & extractedDoorsPathFromConfigSheet & "\"""""
    myCommandString = myCommandString & "-b D:\ExportModulesToExcel.dxl"
    
    'The command string which is stored in "myCommandString" which will be exectued in the invisible command console
    wsh.Run myCommandString, windowStyle, waitOnReturn

 

 

This script now gets the accountdata over a Excel-GUI-Box. In myCommandString is the Batchstring. In the file ExportModulesToExcel.dxl is the script, which runs without failures if you start the script manually in the Interaction-Window, but in case of starting over this command-console, i'm getting a three failures:

-E- DXL: <Line:1> Falsche Argumente für -)
-E- DXL: <Line:1> Nicht deklarierte Variable (b)
-E- DXL: <Line:1> Falsche Argumente für =)

 

I'm weird because the fact, that the script is runnin manually I'm getting no failures but if I start the script automized wih the console, I'm getting failures. Also the Client starts invisible!

If I write the "myCommandString = myCommandString & "-b D:\ExportModulesToExcel.dxl"" line between "myCommandString = myCommandString & "doors.exe "" and "myCommandString = myCommandString & " -user "", the Client starts invisible!

in help file look at runstr or runfile

Re: Start a DXL script from Excel?
Wolfgang Uhr - Tue Apr 12 01:57:10 EDT 2016

Hi Tobi

 

It is not a good idea to use an invisible console for this. Start doors as you allway start doors. Then you can get an access to an automatisation object "Doors.Application". Here you have the commands "runstr" und "runfile". Both commands are documented in the manual. Nearly a year before I've written such a tool and it works well, but you need not only to be a good dxl developer, vba knowledge is also required. And you should know that the conversion of dates and real numbers is something tricky. In the case of the date, midnight in doors is midnight at greenwhich time (based on the integer doors stores into the database) and midnight of VBA is midnight of your local desktop time. So the only possibility you have is to define a standard date exchange format like yyyy/mm/dd hh:MM:ss. Every integer to integer conversion will lead to errors if your code will be started on a pc in the usa or in asia.

 

Best regards

Wolfgang

Re: Start a DXL script from Excel?
Costas..Aravidis - Tue Apr 12 02:26:06 EDT 2016

You can also use OLE automation 

Import the DOORS type library under Tools, References.

 

Then you can use DOORS as an object and execute DXL.

Sub DoorsHello()
    Dim doorsApp As DOORS
    

    Set doorsApp = CreateObject("Doors.Application")
    
    doorsApp.runStr ("print ""hello""")

End Sub

Re: Start a DXL script from Excel?
tobi_mehrl - Tue Apr 12 02:46:30 EDT 2016

Thank you two guys!

 

I have now implemented the suggestion depending on ".runFile". Here is my VBA-Code:

 

Sub Test()

    Dim DOORSObj As doors
    Set DOORSObj = CreateObject("DOORS.Application")
    
    SendKeys "accountname" & "{TAB}" & "password" & "{ENTER}", True
    
    DOORSObj.runFile ("d:\ExportModulesToExcel.dxl")
    
End Sub

 

There are two problems:

If I correctly dimensioning the DOORSObj Variable, I get a compiling error: Excel does not know the user defined type.

If I don't dimensioning the DOORSObj Variable, and start with the Set-Statement, I get an Error in the last line when the .runFile methode will be called. Failure: Runtime Error '-2147417851': The Methode 'runFile' für das Objekt "DIDoorsDXL" is failed.

I think, that this failure is caused, because Excel don't know the Doors-Interface...?! The statement SendKeys delivers no account data. If I start my script, there is in field "Benutzername" my correct Account-Name, but in field Passwort, there is no password...

 

Thx for your help!

 

Edit: I am using Doors 9.6.0.1 and Office 2010.